<?php
    require_once("header.php");
    require_once $_site->get_handlepath('device');

	$type=request('type',false,true,false,1);
	$pid = request('pid',false,true,false,0);
	
	$rtn_type=array(1=>'挖机',2=>'线路',3=>'机手',4=>'地块',5=>'司机',6=>'油罐',7=>'设备',8=>'员工');	
	$rtn_tpl=array(1=>'data_wjsz',2=>'data_xlsz',3=>'data_jssz',4=>'data_dksz',5=>'data_sjsz',6=>'data_ygsz',7=>'data_jysz',8=>'data_ylgly',9=>'data_ylgly',10=>'data_xlsz');
?>
<script type="text/javascript" charset="utf-8">
loader.file({
	plugin:['validform/main','dialog/main','my97/wdatepicker'],
	skincss:['list']
})

function agree(){	
	if(!confirm('是否导入数据？'))return false;
	$("#btn").attr("disabled",true);
	$("#btn").val('数据导入中...');
	setTimeout("postform()",500);          
}
function postform(){			
	$("#form1").submit();	
}
</script>
<style type="text/css">
.table td a.hover{display: line-block;background: #60D277;color: #ffffff;padding:5px;}
</style>
</head>
<body>
	<div class="main">
      <form action="/handle.php" method="post" id="form1" enctype="multipart/form-data">
      <input type="hidden" name="h" value="import/importxls">      
      <input type="hidden" name="pid" value="<?php echo $pid?>">
      <input type="hidden" name="type" value="<?php echo $type?>">      
		<table cellpadding="0" cellspacing="1" border="0" class="table">

			<tr>
			    <td width="100px;">导入数据文件 <font color="red">*</font></td>			
				<td style="text-align: left">
				   <input type="file" name="xls">  
			     </td>							    
			</tr>		
						
			<tr>
				<td colspan="2" >
                      <input type="button" value="导入数据" id="btn" class="button1" onclick="agree()">&nbsp;&nbsp;                      
				</td>
			</tr>
			
			<tr>
				<td colspan="2" >
                       <a href="/data/datatpl/<?php echo $rtn_tpl[$type];?>.xls" target="_blank">点击下载文件模板</a>                      
				</td>
			</tr>			
								
		</table>
	</form>	
		
	</div>
</body>
</html>